<template>
    <el-dialog custom-class="add-dialog"
               :visible.sync="dialogTableVisible"
               :title="titleMsg"
               :close-on-click-modal="false">
        <el-form ref="form"
                 :model="formData"
                 label-width="110px"
                 class="box_acct_form">
            <el-row :gutter="24">
                <el-col :span="12">
                    <el-form-item label="反馈人:">
                        <el-input size="medium"
                                  v-model="formData.username"
                                  :disabled="isNotEdit"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="反馈时间:">
                        <el-date-picker v-model="formData.feedtime"
                                        class="input"
                                        size="medium"
                                        type="date"
                                        style="width: 100%;background-color: #FAFAFA"
                                        :disabled="isNotEdit"
                                        format="yyyy-MM-dd HH:mm:ss">
                        </el-date-picker>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :gutter="24">
                <el-col :span="24">
                    <el-form-item label="反馈内容:">
                        <el-input type="textarea"
                                  :rows="3"
                                  v-model="formData.feedtext"
                                  :disabled="isNotEdit"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :gutter="24">
                <el-col :span="24">
                    <el-form-item label="回复结果:">
                        <el-input type="textarea"
                                  :rows="5"
                                  :disabled="isDetail"
                                  v-model="formData.feedresult"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :gutter="24">
                <el-col :span="12">
                    <el-form-item label="反馈状态:">
                        <el-switch
                                v-model="formData.feedstatus"
                                :disabled="isDetail"
                                active-text="已处理"
                                inactive-text="未处理"
                                :active-value="1"
                                :inactive-value="2">
                        </el-switch>
                    </el-form-item>
                </el-col>
                <el-col :span="12" v-if="this.actionType == 'detail'">
                    <el-form-item label="服务评分:">
                        <el-rate
                                v-model="formData.feedscore"
                                show-text
                                allow-half
                                disabled
                                text-color="#ff9900"
                        style="margin-top: 8px">
                        </el-rate>
                    </el-form-item>
                </el-col>
            </el-row>
        </el-form>
        <span slot="footer"
              class="dialog-footer">
            <el-button v-if="!isDetail"
                       type="primary"
                       class="full-width"
                       @click="close">取消</el-button>
            <el-button v-if="!isDetail"
                       type="primary"
                       class="full-width"
                       @click="submit">回复</el-button>
            <el-button v-else
                       type="primary"
                       class="full-width"
                       @click="dialogTableVisible=false">关闭</el-button>
        </span>
    </el-dialog>
</template>

<script>
    export default {
        name: "feedDialog",
        data() {
            return {
                isNotEdit: true,
                actionType: '',
                // typeInfo: '',
                dialogTableVisible: false,
                loading: false,
                formData:{
                    feedresult: '',
                    feedstatus: ''
                },

            }
        },
        created(){

        },
        computed: {
            titleMsg () {
                if (this.actionType == "edit") {
                    return "反馈处理";
                } else if (this.actionType == "detail") {
                    return "反馈详情";
                }
            },
            isDetail(){
                if (this.actionType == 'detail'){
                    return true;
                } else {
                    return false
                }
            }
        },
        methods:{
            // 接收数据
            init(row){
                this.formData = row
            },
            // 回复提交
            submit(){
                this.$axiosToken({
                    url: '/poster/updateFeedback',
                    method: 'post',
                    data:{
                        f_id: this.formData.f_id,
                        feedresult: this.formData.feedresult,
                        feedstatus: this.formData.feedstatus
                    },
                    success: (result)=>{
                        this.$message({
                            message: '反馈服务回复成功',
                            type: 'success',
                            duration: 2000
                        });
                        this.$parent.getFeedbackData()
                    }
                });
                this.dialogTableVisible = false
            },

            // 取消
            close(){
                this.$parent.getFeedbackData();
                this.dialogTableVisible = false
            }
        }
    }
</script>

<style scoped>
    /deep/.el-dialog__title{
        line-height: 24px;
        font-size: 20px;
        color: #303133;
        font-weight: bolder
    }
    .box_acct_form .el-row .el-col .el-form-item .el-form-item__content .el-input {
        width: 100%;
    }
    .box_acct_form .el-row .el-col .el-form-item .el-form-item__content .el-select {
        width: 100%;
    }
    textarea
    .box_acct_form
    .el-row
    .el-col
    .el-form-item
    .el-form-item__content
    .el-textarea {
        width: 100%;
    }

    .box_acct_form .el-row {
        margin-bottom: 0px;
    }
    /deep/ .add-dialog{
        width: 850px;
        margin: auto;
        overflow: auto;
    }
    .msg_form {
        margin: 7px 15px;
    }

    .msg_form .msg_title {
        clear: both;
        display: block;
        font-weight: bold;
        height: 30px;
        line-height: 30px;
        margin: 0 0 14px;
        position: relative;
        font-weight: bold;
    //color: #327501;
        color: #20a0ff;
        font-size: 16px;
    }

    /deep/ .msg_form .msg_title .msg_title_tips {
        color: #797979;
        font-weight: normal;
        font-size: 12px;
    }

    .msg_box {
        position: relative;
        width: 100%;
    }

    .btn_div {
        text-align: center;
    }
    .btn_div button {
        height: 32px;
        width: 107px;
    }

    .box_content {
        background: #f9f9f9;
        border: 1px solid #d1d1d1;
        padding: 15px;
        margin: 0px 10px;
        position: relative;
    }
    .el-button{
        width: 60px;
        height: 36px;
        font-size: 14px;
    }

    /deep/.el-input.is-disabled .el-input__inner {
        background-color: #FAFAFA;
        /*background-color: #f3f3f1;*/
        color: grey;
    }
    /deep/.el-textarea.is-disabled .el-textarea__inner {
        /*background-color: #FAFAFA;*/
        /*background-color: #f3f3f1;*/
        color: grey;
    }
    /deep/.el-textarea__inner{
        /*font-family: 微软雅黑;*/
        font-family: 楷体;
        font-size: 15px;
    }
</style>